package com.evan.common.service;

import com.evan.common.bit.ZkServerModeEnum;
import com.evan.common.bit.ZkServerStatus;
import com.evan.common.exception.ZkException;
import com.evan.common.pojo.ZkServerInfo;
import org.apache.zookeeper.CreateMode;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public interface ZkServerService {

    List<ZkServerInfo> getAllZkNode();

    ZkServerInfo addZkNode(ZkServerInfo zk) throws Exception;

    List<Map<String, String>> getZkStatus() throws Exception;

    Map<String, List<String>> getZkStatus(String host, int port, String command) throws IOException;

    List<ZkServerInfo> getZkNodeByClusterId(int clusterId);

    String getZkHostInfos(Integer cid) throws ZkException;

    String createZNode(String zkHostInfos, String path, String initData, CreateMode pathMode) throws Exception;

    void delZNode(String zkHostInfos, String path) throws Exception;

    List<String> getZnodeChildren(String path, String zkHostsByClusterId) throws Exception;

    void updateStat(Integer zid, ZkServerModeEnum serverMode, ZkServerStatus online);
}
